package cn.slipi.admin.context;


import cn.slipi.admin.common.context.ThreadContext;
import cn.slipi.admin.constants.AdminConstants;

/**
 * 线程上下文
 *
 * @author lee
 * @date 2019/1/18
 * @since 1.0.0
 */
public class AdminThreadContext extends ThreadContext {

    public static AdminVisitor getApiVisitor() {
        AdminVisitor AdminVisitor = (AdminVisitor) getAttribute(AdminConstants.TOKEN);
        return (AdminVisitor == null || AdminVisitor.getVisitorInfo() == null) ? null : AdminVisitor;
    }

    public static void putApiVisitor(AdminVisitor AdminVisitor) {
        setAttribute(AdminConstants.TOKEN, AdminVisitor);
    }

}
